﻿using System;

namespace BGShell.PowerShell.Controls
{
    internal sealed class ConsoleControlPrivateObject : MarshalByRefObject
    {
        private readonly ConsoleControl _owner;

        internal ConsoleControlPrivateObject(ConsoleControl owner)
        {
            _owner = owner;
        }

        public bool IsBackground
        {
            get { return _owner.IsBackground; }
        }

        public void ClearScreen()
        {
            _owner.InvokeIfRequired(delegate
            {
                _owner.ClearDataTips();

                using (_owner.AllowProtectedUpdates())
                {
                    _owner.TextDocument.DocumentRange.Text = null;   
                }
            });
        }
    }
}
